package com.zdx.yswl.ui.bean;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


public class LpBean extends BaseBean{

	
	private static final long serialVersionUID = -4917389951699687008L;
	/**
	 * 楼盘Id 也是请求id
	 */
	public String id;
	/**
	 * 楼盘名字
	 */
	public String projectName;// 楼盘名字
	/**
	 * 楼盘 地址
	 */
	public String place;//
	/**
	 * 标签
	 */
	public  String[] label;//
	/**
	 * 图片url
	 */
	public String coverUrl; //
	
	


	public static ArrayList<LpBean> getListBeanFromJSON(String json) throws JSONException {
		JSONArray jsonArr = null;
		ArrayList<LpBean> list = new ArrayList<LpBean>();
			jsonArr = new JSONArray(json);
			int lenth = jsonArr.length();
			if (lenth <= 0) {
				return null;
			}

			for (int i = 0; i < lenth; i++) {
				LpBean bean = new LpBean();
				JSONObject jsonObj = jsonArr.getJSONObject(i);
				bean.id = jsonObj.getString("id");
				bean.projectName = jsonObj.getString("projectName");
				bean.place = jsonObj.getString("place");
				
				JSONArray jsonArraylist = jsonObj.getJSONArray("label");
				bean.label = new String[jsonArraylist.length()];
				for (int j = 0; j < jsonArraylist.length(); j++) {
					bean.label[j] = jsonArraylist.getString(j);
				}
				 
				bean.coverUrl = jsonObj.getString("coverUrl");
				list.add(bean);
			}


		return list;
	}
}
